<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns="urn:hl7-org:v3"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdtc="urn:hl7-org:sdtc"
    xmlns:isc="http://extension-functions.intersystems.com" xmlns:exsl="http://exslt.org/common"
    xmlns:set="http://exslt.org/sets" exclude-result-prefixes="isc sdtc exsl set">
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/SqlDocRegModel">
        <RCMR_IN000002UV02 ITSVersion="XML_1.0" xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 ../multicacheschemas/RCMR_IN000002UV02.xsd">
            <!--id-消息流水号-->
            <id root="2.16.156.10011.2.5.1.1" extension="{RegID}"/>
            <!--creationTime-消息创建时间-->
            <creationTime value="{MsgCreateTime}"/>
            <!--interactionId-消息的服务标识-->
            <interactionId root="2.16.156.10011.2.5.1.2" extension="RCMR_IN000002UV02"/>
            <!--processingCode-处理代码。标识此消息是否是产品、训练、调试系统的一部分。D：调试；P：产品；T：训练-->
            <processingCode code="P"/>
            <!--processingModeCode-处理模型代码。定义此消息是一个文档处理还是一个初始装载的一部分。A：存档；I：初始装载；R：从存档中恢复；T：当前处理，间隔传递。-->
            <processingModeCode/>
            <!--acceptAckCode-接收确认类型 AL：总是确认；NE：从不确认；ER：仅在错误/或拒绝时确认；SU：仅在成功完成时确认。-->
            <acceptAckCode code="AL"/>
            <receiver typeCode="RCV">
                <device classCode="DEV" determinerCode="INSTANCE">
                    <id>
                        <item root="2.16.156.10011.2.5.1.3" extension="System"/>
                    </id>
                </device>
            </receiver>
            <sender typeCode="SND">
                <device classCode="DEV" determinerCode="INSTANCE">
                    <id>
                        <item root="2.16.156.10011.2.5.1.3" extension="System"/>
                    </id>
                </device>
            </sender>
            <controlActProcess classCode="STC" moodCode="APT">
                <subject typeCode="SUBJ">
                    <clinicalDocument classCode="DOCCLIN" moodCode="EVN">
                        <!--文档流水号-->
                        <id>
                            <item root="2.16.156.10011.2.5.1.24" extension="{DocNum}"/>
                        </id>
                        <!--文档类型代码-->
                        <xsl:choose>
                            <xsl:when test="DocType &gt; 9">
                                <code code="C00{DocType}" codeSystem="2.16.156.10011.2.5.1.23" codeSystemName="文档类型代码">
                                    <displayName value="{DocName}"/>
                                </code>
                            </xsl:when>
                            <xsl:otherwise>
                                <code code="C000{DocType}" codeSystem="2.16.156.10011.2.5.1.23" codeSystemName="文档类型代码">
                                    <displayName value="{DocName}"/>
                                </code>
                            </xsl:otherwise>
                        </xsl:choose>
                       
                        <statusCode/>
                        <!--文档生成日期时间-->
                        <effectiveTime value="{DocGenDate}"/>
                        <!--文档保密级别-->
                        <confidentialityCode code="N" codeSystem="2.16.156.10011.2.5.1.25" codeSystemName="文档保密级别代码">
                            <displayName value="正常访问保密级别"/>
                        </confidentialityCode>
                        <!--文档版本号-->
                        <versionNumber value="{DocVersion}"/>
                        <storageCode>
                            <!--经base64编码的文档原始内容-->
                            <originalText value="{DocCode64}"/>
                            <!--文档格式-->
                            <translation/>
                        </storageCode>
                        <recordTarget typeCode="RCT">
                            <patient classCode="PAT">
                                <id>
                                    <!--PatientID-->
                                    <item root="2.16.156.10011.2.5.1.4" extension="{PatNum}"/>
                                    <!--住院号标识 -->
                                    <item root="2.16.156.10011.1.12" extension="{InPatNum}"/>
                                    <!--门诊号标识 -->
                                    <item root="2.16.156.10011.1.11" extension="{OutPatNum}"/>
                                </id>
                                <statusCode/>
                                <!--患者就诊日期时间-->
                                <effectiveTime>
                                    <low value="{EncounterTimeStart}"/>
                                    <high value="{EncounterTimeEnd}"/>
                                </effectiveTime>
                                <patientPerson classCode="PSN" determinerCode="INSTANCE">
                                    <!--身份证号-->
                                    <id>
                                        <item root="2.16.156.10011.1.3" extension="{PatNum}"/>
                                    </id>
                                    <!--姓名-->
                                    <name xsi:type="DSET_EN">
                                        <item>
                                            <part value="{PatName}"/>
                                        </item>
                                    </name>
                                </patientPerson>
                                <providerOrganization classCode="ORG" determinerCode="INSTANCE">
                                    <id>
                                        <item root="2.16.156.10011.1.5" extension="{DocCustodianCode}"/>
                                    </id>
                                    <name xsi:type="DSET_EN">
                                        <item>
                                            <part value="{DocCustodianName}"/>
                                        </item>
                                    </name>
                                    <!--科室标识-->
                                    <organizationContains classCode="PART">
                                        <id>
                                            <item root="2.16.156.10011.1.26" extension="科室代码"/>
                                        </id>
                                    </organizationContains>
                                </providerOrganization>
                            </patient>
                        </recordTarget>
                        <!--文档创建者-->
                        <author typeCode="AUT">
                            <time/>
                            <assignedAuthor classCode="ASSIGNED">
                                <id>
                                    <item root="2.16.156.10011.1.4" extension="{DocAuthorCode}"/>
                                </id>
                                <assignedPerson classCode="PSN" determinerCode="INSTANCE">
                                    <name xsi:type="DSET_EN">
                                        <item>
                                            <part value="{DocAuthorName}"/>
                                        </item>
                                    </name>
                                </assignedPerson>
                            </assignedAuthor>
                        </author>
                        <!--文档保管单位-->
                        <custodian typeCode="CST">
                            <assignedCustodian classCode="ASSIGNED">
                                <representedOrganization classCode="ORG" determinerCode="INSTANCE">
                                    <id>
                                        <item root="2.16.156.10011.1.5" extension="{DocCustodianCode}"/>
                                    </id>
                                    <name xsi:type="DSET_EN">
                                        <item>
                                            <part value="{DocCustodianName}"/>
                                        </item>
                                    </name>
                                </representedOrganization>
                            </assignedCustodian>
                        </custodian>
                    </clinicalDocument>
                </subject>
            </controlActProcess>
        </RCMR_IN000002UV02>
    </xsl:template>
</xsl:stylesheet>